import router from "@/router";
import store from "@/store";
import constants from '@/config/constants/systemConstants';

/**
 * 登出操作
 * @param router
 * @param store
 */
export const  logout = () => {
  constants.logoutFlag = false;
  //清空sessionStorage中的数据
  window.sessionStorage.clear();
  //清空vuex中的菜单信息
  store.commit('setUserInfo',[]);
  store.commit('setMenuRoutes',[]);
  //跳转到登录页
  router.replace('/login');
  //ElMessage.error('Token已过期，请重新登录！');
}
